<{include file="public/header.html"}> 
	<header class="title title-border-sm bj-white">
            <a href="<{eval url('account/index')}>" class="icon-return iconfont title-left title-top col-red">&#xe604;</a>
			<h1 class="text-center name">支付宝绑定</h1>
	</header>
	<div class="coin-page">
		<ul class="coin-detail" style="border-top: 0;">
			<li <{if $type==1}>class="active"<{/if}> onclick="window.location.href=$(this).attr('data-href');" data-href="<{eval url('user/bind_list')}>?type=1" style="width:45%" data-action="alipay-list">支付宝绑定</li>
			<li <{if $type==2}>class="active"<{/if}> onclick="window.location.href=$(this).attr('data-href');" data-href="<{eval url('user/bind_list')}>?type=2" style="width:45%" data-action="bank-list">银行卡绑定</li>
		</ul>
	</div>
<div>
    <div class="security alipay-list"<{if $type==2}>style="display: none"<{/if}>>
        <ul class="mt50">
            <{foreach from=$alipay_list item=val}>
            <li class="border-bottom-sm">
                <a href="javascript:;" class="f-cb plr15 data_item">
                    <p class="fl"><{$val['name']}>(<{$val['account']}>)</p>
                    <i class="fr col-grey999 type_on" data-id="<{$val['id']}>">删除</i>
                </a>
            </li><{foreachelse}>
            <li class="border-bottom-sm">
                <a href="javascript:;" class="f-cb plr5" >
                    <p style="text-align: center">--您还没有绑定支付宝--</p>
                </a>
            </li>
            <{/foreach}>
        </ul>
        <input type="button" onclick="window.location.href=$(this).attr('data-href');" data-href="<{eval url('user/cash_bind')}>?type=1" class="btn btn-yes mt10" value="新增">
    </div>
    <div class="security bank-list" <{if $type==1}>style="display: none"<{/if}>>
        <ul class="mt50">
            <{foreach from=$bank_list item=val}>
            <li class="border-bottom-sm">
                <a href="javascript:;" class="f-cb plr15 data_item">
                    <p class="fl"><{$val['name']}>(<{$val['account']}>)</p>
                    <i class="fr col-grey999 type_on" data-id="<{$val['id']}>">删除</i>
                </a>
            </li>
            <{foreachelse}>
            <li class="border-bottom-sm">
                <a href="javascript:;" class="f-cb plr5" >
                    <p style="text-align: center">--您还没有绑定银行卡--</p>
                </a>
            </li>
            <{/foreach}>
        </ul>
        <input type="button" onclick="window.location.href=$(this).attr('data-href');" data-href="<{eval url('user/cash_bind')}>?type=2" class="btn btn-yes mt10" value="新增">
    </div>
</div>
<div class="public-field-bj publick-jq2" id="alert_mes" >
    <div class="public-field-phone w100" id="alert_mes_cont" style="bottom: 5px;">
        <div class="plr15">
            <ul class="bj-white">
                <li data-type="0">确认要删除该条绑定记录吗？</li>
            </ul>
            <button class="btn bj-white mt5" id="delete-bind" data-id="" style="border-radius: 12px;width: 49%;color:#d70e0e">确认</button>
            <button class="btn bj-white mt5 close-jq _close" style="border-radius: 12px;width: 49%;">取消</button>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(".type_on").click(function () {
        var data_id = $(this).attr("data-id");
        $("#delete-bind").attr("data-id",data_id);
        $("#alert_mes").stop().fadeIn();
    });
    $("#alert_mes").click(function () {
        $("#alert_mes").stop().fadeOut();
    });
    $("#delete-bind").on("click",function() {
        var id = $(this).attr("data-id");
        $.ajax({
            type: "GET",
            url: "/user/bind_delete.html?id="+id,
            async: true,
            success: function (resp) {
                resp = $.parseJSON(resp);
                if (resp.reqStatus) {
                    $.mvalidateTip(resp.errorMsg);
                    setTimeout(function () {
                        location.reload();
                    }, 2000);
                } else {
                    $.mvalidateTip(resp.errorMsg);
                    setTimeout(function () {
                        location.reload();
                    }, 2000);
                }
            }
        });

    });
</script>
<{include file="public/footer.html"}> 